package com.tangyuan.video.controller;

import com.tangyuan.common.result.Result;
import com.tangyuan.video.service.VideoCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/video")
public class   VideoCollectionController {

    @Autowired
    VideoCollectionService videoCollectionService;

    //用户收藏视频
    @GetMapping("/collection/save")
    public Result<Object> addCollectionVideo(@RequestHeader(name = "userId", required = false) Long userId, @RequestParam Long videoId) {
        return videoCollectionService.saveCollectionVideo(userId, videoId);
    }

    //用户取消收藏
    @GetMapping("/collection/remove")
    public Result<Object> removeCollectionVideo(@RequestHeader(name = "userId", required = false) Long userId, @RequestParam Long videoId) {
        return videoCollectionService.saveCollectionVideo(userId, videoId);
    }
}
